package com.model;

// Generated 2013-8-25 14:56:38 by Hibernate Tools 3.6.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * User generated by hbm2java
 */
@Entity
@Table(name = "user")
public class User implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7202102030146299482L;

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Integer id;

	@Column(name = "name", nullable = false, length = 64)
	private String name;
	@Column(name = "gender", nullable = false)
	private int gender;
	@Column(name = "email", nullable = false, length = 64)
	private String email;
	@Column(name = "password", nullable = false, length = 128)
	private String password;
	@Column(name = "profession", length = 64)
	private String profession;
	@Column(name = "private_url")
	private String privateUrl;
	@Column(name = "profile")
	private String profile;
	@Column(name = "head_img", length = 64)
	private String headImg;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "birthday", length = 19)
	private Date birthday;
	@Column(name = "qq")
	private String qq;
	@Column(name = "score", nullable = false)
	private int score;
	@Column(name = "answers_num", nullable = false)
	private int answersNum;
	@Column(name = "questions_num", nullable = false)
	private int questionsNum;
	@Column(name = "favor_num", nullable = false)
	private int favorNum;

	@Column(name = "article_num", nullable = false)
	private int articleNum;
	@Column(name = "follow_num", nullable = false)
	private int followNum;
	@Column(name = "fans_num", nullable = false)
	private int fansNum;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_login_time", nullable = false, length = 19)
	private Date lastLoginTime;
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_at", nullable = false, length = 19)
	private Date createAt;
	@Column(name = "sequence_login", nullable = false)
	private int sequenceLogin;
	@Column(name = "vip", nullable = false)
	private int vip;
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByUserId")
	private Set<Question> questionsForUserId = new HashSet<Question>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByQuestionUserId")
	private Set<Question> questionsForQuestionUserId = new HashSet<Question>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	private Set<QuestionAction> questionActions = new HashSet<QuestionAction>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	private Set<QuestionComment> questionComments = new HashSet<QuestionComment>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	private Set<Article> articles = new HashSet<Article>(0);
	//	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	//	private Set<Timeline> timelines = new HashSet<Timeline>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByUserId")
	private Set<Relation> relationsForUserId = new HashSet<Relation>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	private Set<ArticleComment> articleComments = new HashSet<ArticleComment>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "userByUserById")
	private Set<Relation> relationsForUserById = new HashSet<Relation>(0);
	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "user_tag", catalog = "askme", joinColumns = { @JoinColumn(name = "user_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "tag_id", nullable = false, updatable = false) })
	private Set<Tag> tags = new HashSet<Tag>(0);
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "user")
	private Set<ArticleAction> articleActions = new HashSet<ArticleAction>(0);

	public User() {
	}
	
	public User(String init){
		this.name = null;
		this.gender = 0;
		this.email = null;
		this.password = null;
		this.score = 0;
		this.answersNum = 0;
		this.questionsNum = 0;
		this.favorNum = 0;
		this.lastLoginTime = null;
		this.createAt = null;
		this.sequenceLogin = 0;
		this.vip = 0;
	}

	public User(String name, byte gender, String email, String password, int score, int answersNum,
			int questionsNum, int favorNum, Date lastLoginTime, Date createAt, int sequenceLogin,
			int vip) {
		this.name = name;
		this.gender = gender;
		this.email = email;
		this.password = password;
		this.score = score;
		this.answersNum = answersNum;
		this.questionsNum = questionsNum;
		this.favorNum = favorNum;
		this.lastLoginTime = lastLoginTime;
		this.createAt = createAt;
		this.sequenceLogin = sequenceLogin;
		this.vip = vip;
	}

	public User(String name, byte gender, String email, String password, String profession,
			String privateUrl, String profile, String headImg, Date birthday, String qq, int score,
			int answersNum, int questionsNum, int favorNum, Date lastLoginTime, Date createAt,
			int sequenceLogin, int vip, Set<Question> questionsForUserId,
			Set<Question> questionsForQuestionUserId, Set<QuestionAction> questionActions,
			Set<QuestionComment> questionComments, Set<Article> articles,
			Set<Relation> relationsForUserId, Set<ArticleComment> articleComments,
			Set<Relation> relationsForUserById, Set<Tag> tags, Set<ArticleAction> articleActions) {
		this.name = name;
		this.gender = gender;
		this.email = email;
		this.password = password;
		this.profession = profession;
		this.privateUrl = privateUrl;
		this.profile = profile;
		this.headImg = headImg;
		this.birthday = birthday;
		this.qq = qq;
		this.score = score;
		this.answersNum = answersNum;
		this.questionsNum = questionsNum;
		this.favorNum = favorNum;
		this.lastLoginTime = lastLoginTime;
		this.createAt = createAt;
		this.sequenceLogin = sequenceLogin;
		this.vip = vip;
		this.questionsForUserId = questionsForUserId;
		this.questionsForQuestionUserId = questionsForQuestionUserId;
		this.questionActions = questionActions;
		this.questionComments = questionComments;
		this.articles = articles;
		this.relationsForUserId = relationsForUserId;
		this.articleComments = articleComments;
		this.relationsForUserById = relationsForUserById;
		this.tags = tags;
		this.articleActions = articleActions;
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getProfession() {
		return this.profession;
	}

	public void setProfession(String profession) {
		this.profession = profession;
	}

	public String getPrivateUrl() {
		return this.privateUrl;
	}

	public void setPrivateUrl(String privateUrl) {
		this.privateUrl = privateUrl;
	}

	public String getProfile() {
		return this.profile;
	}

	public void setProfile(String profile) {
		this.profile = profile;
	}

	public String getHeadImg() {
		return this.headImg;
	}

	public void setHeadImg(String headImg) {
		this.headImg = headImg;
	}

	public Date getBirthday() {
		return this.birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public String getQq() {
		return this.qq;
	}

	public void setQq(String qq) {
		this.qq = qq;
	}

	public int getScore() {
		return this.score;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getAnswersNum() {
		return this.answersNum;
	}

	public void setAnswersNum(int answersNum) {
		this.answersNum = answersNum;
	}

	public int getQuestionsNum() {
		return this.questionsNum;
	}

	public void setQuestionsNum(int questionsNum) {
		this.questionsNum = questionsNum;
	}

	public int getFavorNum() {
		return this.favorNum;
	}

	public void setFavorNum(int favorNum) {
		this.favorNum = favorNum;
	}

	public Date getLastLoginTime() {
		return this.lastLoginTime;
	}

	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}

	public Date getCreateAt() {
		return this.createAt;
	}

	public void setCreateAt(Date createAt) {
		this.createAt = createAt;
	}

	public int getSequenceLogin() {
		return this.sequenceLogin;
	}

	public void setSequenceLogin(int sequenceLogin) {
		this.sequenceLogin = sequenceLogin;
	}

	public int getVip() {
		return this.vip;
	}

	public void setVip(int vip) {
		this.vip = vip;
	}

	public Set<Question> getQuestionsForUserId() {
		return this.questionsForUserId;
	}

	public void setQuestionsForUserId(Set<Question> questionsForUserId) {
		this.questionsForUserId = questionsForUserId;
	}

	public Set<Question> getQuestionsForQuestionUserId() {
		return this.questionsForQuestionUserId;
	}

	public void setQuestionsForQuestionUserId(Set<Question> questionsForQuestionUserId) {
		this.questionsForQuestionUserId = questionsForQuestionUserId;
	}

	public Set<QuestionAction> getQuestionActions() {
		return this.questionActions;
	}

	public void setQuestionActions(Set<QuestionAction> questionActions) {
		this.questionActions = questionActions;
	}

	public Set<QuestionComment> getQuestionComments() {
		return this.questionComments;
	}

	public void setQuestionComments(Set<QuestionComment> questionComments) {
		this.questionComments = questionComments;
	}

	public Set<Article> getArticles() {
		return this.articles;
	}

	public void setArticles(Set<Article> articles) {
		this.articles = articles;
	}

	public Set<Relation> getRelationsForUserId() {
		return this.relationsForUserId;
	}

	public void setRelationsForUserId(Set<Relation> relationsForUserId) {
		this.relationsForUserId = relationsForUserId;
	}

	public Set<ArticleComment> getArticleComments() {
		return this.articleComments;
	}

	public void setArticleComments(Set<ArticleComment> articleComments) {
		this.articleComments = articleComments;
	}

	public Set<Relation> getRelationsForUserById() {
		return this.relationsForUserById;
	}

	public void setRelationsForUserById(Set<Relation> relationsForUserById) {
		this.relationsForUserById = relationsForUserById;
	}

	public Set<Tag> getTags() {
		return this.tags;
	}

	public void setTags(Set<Tag> tags) {
		this.tags = tags;
	}

	public Set<ArticleAction> getArticleActions() {
		return this.articleActions;
	}

	public void setArticleActions(Set<ArticleAction> articleActions) {
		this.articleActions = articleActions;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public int getArticleNum() {
		return articleNum;
	}

	public void setArticleNum(int articleNum) {
		this.articleNum = articleNum;
	}

	public int getFollowNum() {
		return followNum;
	}

	public void setFollowNum(int followNum) {
		this.followNum = followNum;
	}

	public int getFansNum() {
		return fansNum;
	}

	public void setFansNum(int fansNum) {
		this.fansNum = fansNum;
	}

	//	public Set<Timeline> getTimelines() {
	//		return timelines;
	//	}
	//
	//	public void setTimelines(Set<Timeline> timelines) {
	//		this.timelines = timelines;
	//	}

}
